package fr.paris.lutece.plugins.${plugin.name}.service;

import javax.inject.Inject;
import javax.inject.Named;

import fr.paris.lutece.plugins.lel.business.bean.${bean.name?cap_first};
import fr.paris.lutece.plugins.lel.business.bean.${bean.name?cap_first}Filter;
import fr.paris.lutece.plugins.lel.business.dao.I${bean.name?cap_first}DAO;
import fr.paris.lutece.plugins.lel.business.dao.PaginationProperties;
import fr.paris.lutece.plugins.lel.commons.ResultList;
<#if bean.withDTO >import fr.paris.lutece.plugins.lel.business.dto.${bean.name?cap_first}DTO;</#if>
<#if bean.withDTO >import fr.paris.lutece.plugins.lel.service.converter.${bean.name?cap_first}Converter;</#if >

/**
 * The ${bean.name?cap_first} class service
 * @author ${bean.author}
 */
public class ${bean.name?cap_first}Service implements I${bean.name?cap_first}Service extends AbstractService{

	@Inject
	@Named("${plugin.name}.${bean.name}DAO")
	private I${bean.name?cap_first}DAO _dao${bean.name?cap_first};

	@Override
	public ResultList<${bean.name?cap_first}<#if bean.withDTO >DTO</#if>> findAll(PaginationProperties paginationProperties) {
		ResultList<${bean.name?cap_first}> find = _dao${bean.name?cap_first}.findAll(paginationProperties);
		<#if bean.withDTO >
			ResultList<${bean.name?cap_first}DTO> convertEntities = ${bean.name?cap_first}Converter.convertEntities(find);
			return convertEntities;
		<#else>
			return find;
		</#if>
	}

	@Override
	public ResultList<${bean.name?cap_first}<#if bean.withDTO >DTO</#if>> find(${bean.name?cap_first}Filter filter, PaginationProperties paginationProperties) {
		ResultList<${bean.name?cap_first}> find = _dao${bean.name?cap_first}.find(filter,paginationProperties);
		<#if bean.withDTO >
			ResultList<${bean.name?cap_first}DTO> convertEntities = ${bean.name?cap_first}Converter.convertEntities(find);
			return convertEntities;
		<#else>
			return find;
		</#if>
	}

}